package cn.ht.bootdemo.designmode.proxy.service.impl;

import cn.ht.bootdemo.designmode.proxy.service.BuyHouseService;

/**
 * @author ht
 * @Description:
 * @date 2020-5-13
 */
public class BuyHouseServiceProxy implements BuyHouseService {

    private BuyHouseService buyHouseService;

    public BuyHouseServiceProxy(final BuyHouseService buyHouseService) {
        this.buyHouseService = buyHouseService;
    }

    @Override
    public void buyHouse(long money) {
        long myMoney = findProxyer(money);
        buyHouseService.buyHouse(myMoney);
        long l = updateHose(myMoney);
        System.out.println("只剩了"+l);
    }

    //找中介
    private long findProxyer(long money) {
        long l = money - 10000;
        System.out.println("找中介花了10000！还剩下了："+l);
        return l;
    }

    //装修
    private long updateHose(long myMoney) {
        long l = myMoney - 300000;
        System.out.println("装修花了300000！还剩下了："+l);
        return l;
    }

}
